package com.wuyong.chapter9;

public class Main {

    public static void main(String[] args) {
        Integer[] nums = {-2, 0, 3, -5, 2, -1};
        SegmentTree<Integer> segmentTree = new SegmentTree<>(nums, new Merger<Integer>() {
            @Override
            public Integer merger(Integer a, Integer b) {
                return a + b;
                //return max(a , b);
            }
        });
        Integer res = segmentTree.query(0,5);
        System.out.println(res);
    }


    public static int max(int a , int b){
        if (a > b) {
            return a;

        } else
            return b;
    }
}
